import request from '@/utils/request'

// 获取工单状态分类列表
export const getTaskStatus = () => request.get('/api/task-service/task/allTaskStatus')

// 获取工单分类列表
export const getTaskType = () => request.get('/api/task-service/taskType/list')

// 获取工单列表
export const getTaskSearch = data => request.get('/api/task-service/task/search', { params: data })

// 获取工单详情
export const getTaskInof = taskID => request.get('/api/task-service/task/taskInfo/' + taskID)

// 补货详情
export const getTaskDetails = taskID => request.get('/api/task-service/taskDetails/' + taskID)

// 取消工单
export const taskCancel = taskID => request.post('/api/task-service/task/cancel/' + taskID, { taskId: taskID, desc: '' })

// 工单配置自动补货工单阈值获取
export const supplyAlertValue = () => request.get('/api/task-service/task/supplyAlertValue')

// 工单配置自动补货工单阈值设置
export const autoSupplyConfig = alertValue => request.post('/api/task-service/task/autoSupplyConfig', { alertValue: alertValue })

// 获取新建工单的运营人员
export const newTaskUser = id => request({
  method: 'GET',
  url: '/api/user-service/user/operatorList/' + id
})

// 获取补货详情
export const getChannelList = id => request({
  method: 'GET',
  url: '/api/vm-service/channel/channelList/' + id
})

// 创建工单
export const postTask = data => request.post('/api/task-service/task/create', data)
